# 继承武器脚本!伟大!
extends Weapon
class_name SingleShot

# 创建子弹并射向对方
func shoot(source,target,scene_tree) -> void:
	if null == target:
		return
	var projectile = projectile_node.instantiate()
	projectile.position = source.position
	projectile.damage = damage
	projectile.speed = speed
	projectile.source = source
	projectile.direction = (target.position - source.position).normalized()
	scene_tree.current_scene.add_child(projectile)

# 激活子弹
func activate(source,target,scene_tree):
	shoot(source,target,scene_tree)

#升级物品
func upgrade_item()->void:
	if max_level_reached():
		slot.item = evolution
		return
	if not is_upgradable():
		return
	var upgrade = upgrades[level - 1]
	damage += upgrade.damage
	cooldown += upgrade.cooldown
	speed += upgrade.speed
	level += 1

	
